<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="mailbox-mmdfmessage.html" />
<link rel="prev" href="mailbox-mhmessage.html" />
<link rel="parent" href="mailbox-message-objects.html" />
<link rel="next" href="mailbox-mmdfmessage.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>7.3.2.4 BabylMessage</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7.3.2.3 MHMessage"
  href="mailbox-mhmessage.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="7.3.2 message objects"
  href="mailbox-message-objects.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7.3.2.5 MMDFMessage"
  href="mailbox-mmdfmessage.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="mailbox-mhmessage.html">7.3.2.3 MHMessage</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="mailbox-message-objects.html">7.3.2 Message objects</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="mailbox-mmdfmessage.html">7.3.2.5 MMDFMessage</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h3><a name="SECTION009324000000000000000"></a>
<a name="mailbox-babylmessage"></a>
<br>
7.3.2.4 <tt class="class">BabylMessage</tt>
</h3>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-1432' xml:id='l2h-1432' class="class">BabylMessage</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>message</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
A message with Babyl-specific behaviors. Parameter <var>message</var> has the same
meaning as with the <tt class="class">Message</tt> constructor.
</dl>

<p>
Certain message labels, called <i class="dfn">attributes</i>, are defined by convention to
have special meanings. The attributes are as follows:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Label</th>
      <th class="left"  >Explanation</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">unseen</td>
        <td class="left"  >Not read, but previously detected by MUA</td></tr>
    <tr><td class="left"   valign="baseline">deleted</td>
        <td class="left"  >Marked for subsequent deletion</td></tr>
    <tr><td class="left"   valign="baseline">filed</td>
        <td class="left"  >Copied to another file or mailbox</td></tr>
    <tr><td class="left"   valign="baseline">answered</td>
        <td class="left"  >Replied to</td></tr>
    <tr><td class="left"   valign="baseline">forwarded</td>
        <td class="left"  >Forwarded</td></tr>
    <tr><td class="left"   valign="baseline">edited</td>
        <td class="left"  >Modified by the user</td></tr>
    <tr><td class="left"   valign="baseline">resent</td>
        <td class="left"  >Resent</td></tr></tbody>
</table></div>

<p>
By default, Rmail displays only
visible headers. The <tt class="class">BabylMessage</tt> class, though, uses the original
headers because they are more complete. Visible headers may be accessed
explicitly if desired.

<p>
<tt class="class">BabylMessage</tt> instances offer the following methods:

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1433' xml:id='l2h-1433' class="method">get_labels</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Return a list of labels on the message.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1434' xml:id='l2h-1434' class="method">set_labels</tt></b>(</nobr></td>
  <td><var>labels</var>)</td></tr></table></dt>
<dd>
Set the list of labels on the message to <var>labels</var>.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1435' xml:id='l2h-1435' class="method">add_label</tt></b>(</nobr></td>
  <td><var>label</var>)</td></tr></table></dt>
<dd>
Add <var>label</var> to the list of labels on the message.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1436' xml:id='l2h-1436' class="method">remove_label</tt></b>(</nobr></td>
  <td><var>label</var>)</td></tr></table></dt>
<dd>
Remove <var>label</var> from the list of labels on the message.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1437' xml:id='l2h-1437' class="method">get_visible</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Return an <tt class="class">Message</tt> instance whose headers are the message's visible
headers and whose body is empty.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1438' xml:id='l2h-1438' class="method">set_visible</tt></b>(</nobr></td>
  <td><var>visible</var>)</td></tr></table></dt>
<dd>
Set the message's visible headers to be the same as the headers in
<var>message</var>. Parameter <var>visible</var> should be a <tt class="class">Message</tt> instance, an
<tt class="class">email.Message.Message</tt> instance, a string, or a file-like object (which
should be open in text mode).
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1439' xml:id='l2h-1439' class="method">update_visible</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
When a <tt class="class">BabylMessage</tt> instance's original headers are modified, the
visible headers are not automatically modified to correspond. This method
updates the visible headers as follows: each visible header with a
corresponding original header is set to the value of the original header, each
visible header without a corresponding original header is removed, and any of
<span class="mailheader">Date:</span>, <span class="mailheader">From:</span>, <span class="mailheader">Reply-To:</span>, <span class="mailheader">To:</span>,
<span class="mailheader">CC:</span>, and <span class="mailheader">Subject:</span> that are present in the original
headers but not the visible headers are added to the visible headers.
</dl>

<p>
When a <tt class="class">BabylMessage</tt> instance is created based upon a
<tt class="class">MaildirMessage</tt> instance, the following conversions take place:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Resulting state</th>
      <th class="left"  ><tt class="class">MaildirMessage</tt> state</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">"unseen" label</td>
        <td class="left"  >no S flag</td></tr>
    <tr><td class="left"   valign="baseline">"deleted" label</td>
        <td class="left"  >T flag</td></tr>
    <tr><td class="left"   valign="baseline">"answered" label</td>
        <td class="left"  >R flag</td></tr>
    <tr><td class="left"   valign="baseline">"forwarded" label</td>
        <td class="left"  >P flag</td></tr></tbody>
</table></div>

<p>
When a <tt class="class">BabylMessage</tt> instance is created based upon an
<tt class="class">mboxMessage</tt> or <tt class="class">MMDFMessage</tt> instance, the <span class="mailheader">Status:</span>
and <span class="mailheader">X-Status:</span> headers are omitted and the following conversions
take place:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Resulting state</th>
      <th class="left"  ><tt class="class">mboxMessage</tt> or <tt class="class">MMDFMessage</tt> state</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">"unseen" label</td>
        <td class="left"  >no R flag</td></tr>
    <tr><td class="left"   valign="baseline">"deleted" label</td>
        <td class="left"  >D flag</td></tr>
    <tr><td class="left"   valign="baseline">"answered" label</td>
        <td class="left"  >A flag</td></tr></tbody>
</table></div>

<p>
When a <tt class="class">BabylMessage</tt> instance is created based upon an <tt class="class">MHMessage</tt>
instance, the following conversions take place:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Resulting state</th>
      <th class="left"  ><tt class="class">MHMessage</tt> state</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">"unseen" label</td>
        <td class="left"  >"unseen" sequence</td></tr>
    <tr><td class="left"   valign="baseline">"answered" label</td>
        <td class="left"  >"replied" sequence</td></tr></tbody>
</table></div>

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7.3.2.3 MHMessage"
  href="mailbox-mhmessage.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="7.3.2 message objects"
  href="mailbox-message-objects.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7.3.2.5 MMDFMessage"
  href="mailbox-mmdfmessage.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="mailbox-mhmessage.html">7.3.2.3 MHMessage</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="mailbox-message-objects.html">7.3.2 Message objects</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="mailbox-mmdfmessage.html">7.3.2.5 MMDFMessage</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
